package castledefense.game.render;

import com.badlogic.gdx.Gdx;

import com.badlogic.gdx.graphics.GL10;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import castledefense.data.Resources;
import castledefense.game.screens.MainGameScreen;
import castledefense.logic.Map;

final public class RenderMap {

	public static void drawMap(Map map, SpriteBatch batch) {

		batch.draw(Resources.grassIm, 0, 0, MainGameScreen.mapSizeX
				* Map.cellWidth, MainGameScreen.mapSizeY * Map.cellWidth);

		batch.end();

		GraphicsUtil.startBlend();
		Gdx.gl10.glColor4f(0f, 0f, 0f, 0.25f);
		Resources.gridMesh.render(GL10.GL_LINES);
		GraphicsUtil.endBlend();
		Gdx.gl10.glColor4f(1f, 1f, 1f, 1f);

		batch.begin();
		// Draw all unit s
		RenderUnit.draw(map, batch);

		// draw ball duildings
		RenderBuilding.draw(map, batch);

		// RenderUnitPath.draw(map, batch);
	}

}
